
public  class Son extends Person{

	int grade;
	{
		System.out.println("子类的无参构造函数");
	}
	
	static {
		System.out.println("子类的static");	
	}
	
	Son(){
		//super();//运行子类的要先运行父类无参构造函数，此处省略默认执行父类无参构造函数
		System.out.println("子类的无参构造函数");
	}

	Son(String name,int age,int grade){
		//super();//运行子类的要先运行父类有参构造函数，若父类无有参的，则运行父类的无参构造函数
		this.grade = grade;
		System.out.println("子类的有参构造函数：" + "name:"+name +",age:" +age+",grade:"+ grade);
	}
	void eat()
	{
		System.out.println("子类吃饭");
	}

	public static void main(String arg[])
	{
		System.out.println("子类的主方法");
		Son s1 = new Son();
		Son s2 = new Son("王晓",40,10001);
		s1.eat();
		s2.eat();
	}
}
